#
#  makefile for runtime libraries
#
.SUFFIXES:
.SUFFIXES:	.lib .obl .c

#
# For Large (nay, HUGE) Library
#
CLFLAGS = -nologo $(OPTIMIZ) -W4 -Za -I. -I$(INCL)\
		 -AH $(TEST)

INCL	= ../incl
OPTIMIZ	= -Ot -Gs -Gy

.c.obl:
	cl -c $(CLFLAGS) -Fo$*.obl $<

CEPHES_SRCS_1 =	chdtr.c\
		const.c\
		fac.c\
		gamma.c\
		igam.c\
		igami.c

CEPHES_SRCS_2 =	ndtr.c\
		ndtri.c\
		polevl.c\
		powi.c\
		mtherr.c

CEPHES_L_OBJS_1 =	$(CEPHES_SRCS_1:.c=.obl)
CEPHES_L_OBJS_2 =	$(CEPHES_SRCS_2:.c=.obl)

MISC_SRCS_ALL =	$(MISC_SRCS_1) $(MISC_SRCS_2)\
                $(MISC_SRCS_2) $(MISC_SRCS_4)

MISC_SRCS_1 =	abrtgcly.c\
		bincoef.c\
		bitmanip.c\
		calcharm.c\
		calcmnsd.c\
		chisqdst.c

MISC_SRCS_2 =	drand.c\
		getchr.c\
		getdbl.c\
		getinitd.c\
		getint.c\
		getldbl.c

MISC_SRCS_3 =   getlong.c\
		getuint.c\
		kscalc.c\
		ksinv.c\
		ksmirnov.c\
		m77rand.c

MISC_SRCS_4 =	marsag.c\
		rand250.c\
		randcomb.c\
		randmzj.c\
		randport.c\
		rands55.c\
		stirling.c

MISC_OBJS_L_1 =	$(MISC_SRCS_1:.c=.obl)
MISC_OBJS_L_2 =	$(MISC_SRCS_2:.c=.obl)
MISC_OBJS_L_3 =	$(MISC_SRCS_3:.c=.obl)
MISC_OBJS_L_4 =	$(MISC_SRCS_4:.c=.obl)

all:	lmiscsub.lib  lcephes.lib

lmiscsub.lib:	$(MISC_OBJS_L_1) $(MISC_OBJS_L_2)\
		$(MISC_OBJS_L_3) $(MISC_OBJS_L_4)
	@-move lmiscsub.lib lmiscsub.old > nul
	lib /nologo lmiscsub @fcnslist.1
#	rm -f fcnslist.1

lcephes.lib: $(CEPHES_L_OBJS_1) $(CEPHES_L_OBJS_2)
	@-move lcephes.lib lcephes.old > nul
	lib /nologo lcephes @fcnslist.2
#	rm -f fcnslist.2

bitmanip.obl:	bitmanip.c	bit_hlrs.h
getinitd.obl:	getinitd.c	qrmrand.c

save:
	@-echo Saving Sources - Library Source Files
	-pkzip -ex -u -x*.bak b:/randlibs *.c *.h\
				makefile*.* top header
	@-echo Saving Sources - Header Files
	-pkzip -ex -u -xstatus.me -x*.bak b:randincl\
				$(INCL)/*.*
